/**
 * 
 */
package com.feizhi.common.upload.bean;

import org.springframework.web.multipart.MultipartFile;

/**
 * @author shuaqiu 2013年11月17日
 *
 */
public class UploadResult {

	private final String name;
	private final String contentType;
	private final long size;

	private final String ext;

	private String uri;

	public UploadResult(MultipartFile file) {
		name = file.getOriginalFilename();
		contentType = file.getContentType();
		size = file.getSize();

		int index = name.lastIndexOf(".");
		if (index == -1) {
			ext = "";
		} else {
			ext = name.substring(index);
		}
	}

	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}

	/**
	 * @return the contentType
	 */
	public String getContentType() {
		return contentType;
	}

	/**
	 * @return the size
	 */
	public long getSize() {
		return size;
	}

	/**
	 * @return the ext
	 */
	public String getExt() {
		return ext;
	}

	/**
	 * @return the uri
	 */
	public String getUri() {
		return uri;
	}

	/**
	 * @param uri
	 *            the uri to set
	 */
	public void setUri(String uri) {
		this.uri = uri;
	}

}
